package com.wen.controller.biz;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wen.business.service.LoginLogService;
import com.wen.common.annotation.RepeatSubmit;
import com.wen.common.pojo.account.LoginLog;
import com.wen.common.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *
 * @author liwen <devinlive@163.com>
 * @version 1.0
 * @since 2022-10-31 23:20
 */
@RestController
@RequestMapping("log")
public class LogController {

    @Autowired
    private LoginLogService loginLogService;

    @GetMapping("/loginPage")
    @RepeatSubmit
    public ResponseResult<?> findPage(@RequestParam(defaultValue = "") String loginUser,
                                      @RequestParam(defaultValue = "1") int pageNum,
                                      @RequestParam(defaultValue = "10") int pageSize,
                                      @RequestParam(defaultValue = "") String beginTm,
                                      @RequestParam(defaultValue = "") String endTm){

        Page<LoginLog> logPage = loginLogService.findPage(pageNum, pageSize, beginTm, endTm, loginUser);
        return ResponseResult.success(logPage);
    }
}
